define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'final_accounts.type/index',
        add_url: 'final_accounts.type/add',
        edit_url: 'final_accounts.type/edit',
        delete_url: 'final_accounts.type/delete',
    };

    var Controller = {
        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh', 'add', 'delete'],
                cols: [[
                    {type: "checkbox"},
                    {field: 'time', minWidth: 80, title: '日期',search:'range',templet: ea.table.date_to_time},
                    {field: 'type', minWidth: 150, title: '类型',search:'select',selectList: {1: '当期现金净流入',2:'当期支出',3:'当期毛利',4:'当期毛利率',5:'当期负债'}},
                    {field: 'total', minWidth: 100, title: '合计',search:false},
                    {field: 'project_total', minWidth: 100, title: '项目组合计',search:false},
                    {field: 'no_project_total', minWidth: 100, title: '非项目组合计',search:false},
                    {field: 'teacher_project_total', minWidth: 100, title: '考教师项目合计',search:false},
                    {field: 'kb_total', minWidth: 100, title: '考编合计',search:false},
                    {field: 'kb_project_total', minWidth: 100, title: '考编-公共学科合计',search:false},
                    {minWidth: 100,title: '操作', templet: ea.table.tool}
                ]],
            });
            
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        download_tpl_url: function () {
            ea.listen();
        },
    };
    return Controller;
});